/*
	© Simone Esposito - 2013
*/

using UnityEngine;
using System.Collections;

public class TopDownCamera : MonoBehaviour {
	public float distance = 120.0f;
	public float height = 150.0f;
	public Transform target;

	void LateUpdate () {
		if (!target)
			return;
		
		// follow target at given distance and height
		Vector3 p = transform.position;
		p.x = target.position.x + distance;
		p.y = target.position.y + height;
		p.z = target.position.z;
		transform.position = p;
		
		// look at target
		transform.LookAt(target.position);
	}
}